package com.community.process._1010.domains;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * @Description: 订单DTO
 * @Author: Administrator to Zbs
 * @Date: 2024/9/6 星期五 18:14
 */
public class ProcessOrderDTO {

    @Getter
    @Setter
    @AllArgsConstructor
    @NoArgsConstructor
    public static class BaseCreateOrder {

        @Schema(description = "优惠券ID")
        private List<Long> couponIds;

        @Schema(description = "手机号")
        private String phone;

        @Schema(description = "联系人")
        private String contactPerson;

        @Schema(description = "地区ID")
        private Long areaId;

        @Schema(description = "地区名称")
        private String areaName;

        @Schema(description = "市ID")
        private Long cityId;

        @Schema(description = "市名称")
        private String cityName;

        @Schema(description = "省ID")
        private Long provinceId;

        @Schema(description = "省名称")
        private String provinceName;

        @Schema(description = "收货详细地址")
        private String addr;

        @Schema(description = "就餐时间")
        private String dinnerTime;

        @Schema(description = "店铺名称")
        private String shopName;

        @Schema(description = "店铺地址")
        private String detailedAddress;

        @Schema(description = "店铺id")
        private Long shopId;
    }

    @Getter
    @Setter
    @Schema(description = "购物车商品")
    public static class ItemCart {

        @Schema(description = "商品ID")
        private Long itemId;

        @Schema(description = "商品数量")
        private Integer itemNum;

    }

    @Getter
    @Setter
    @Schema(description = "购物车")
    public static class Cart {

        @Schema(description = "口袋编号（前端生成，不重复就行，12345...）")
        private Integer pocket;

        @Schema(description = "商品类型 1 自带食材 2 成品菜 3 自组食材")
        private Integer type;

        @Schema(description = "商品列表")
        private List<ItemCart> items;

        @Schema(description = "备注")
        private String remark;

        @Schema(description = "就餐时间")
        private String dinnerTime;

        @Schema(description = "店铺名称")
        private String shopName;

        @Schema(description = "店铺地址")
        private String detailedAddress;

        @Schema(description = "店铺id")
        private Long shopId;
    }

    @Schema(description = "购物车下单")
    @Getter
    @Setter
    public static class CartCreateOrder extends BaseCreateOrder {
        @Schema(description = "购物车列表")
        private List<Cart> carts;
    }

    @Getter
    @Setter
    @AllArgsConstructor
    @NoArgsConstructor
    @Schema(description = "申请退款DTO")
    public static class ApplyForARefundDTO {
        @Schema(description = "订单ID",requiredMode = Schema.RequiredMode.REQUIRED)
        @NotNull(message = "订单ID不能为空")
        private Long id;
        @Schema(description = "退款原因")
        private String refundReason;
    }

    @Getter
    @Setter
    @AllArgsConstructor
    @NoArgsConstructor
    @Schema(description = "拒绝退款DTO")
    public static class RefundForARefundDTO {
        @Schema(description = "订单ID",requiredMode = Schema.RequiredMode.REQUIRED)
        @NotNull(message = "订单ID不能为空")
        private Long id;
        @Schema(description = "拒绝退款原因")
        @NotBlank(message = "拒绝退款原因不能为空")
        private String reason;
    }
}
